Repository navigation
release: 2.1.0 — JRuby Java escaper, TruffleRuby on pure Ruby, Ruby 4 - #10
Merged
Merged
Conversation
Faster, correct native paths for the non-CRuby engines, plus a bump to the current stable Ruby for the pinned CI jobs. JRuby: add a tiny Java extension (ext/java, Ruby2html::JavaNative) that accelerates HTML escaping -- the renderer's hot path -- over the pure-Ruby twin. ~1.9x faster end-to-end rendering (13k -> 25k renders/s), byte-identical output (verified against the C extension and the regex branch across UTF-8/US-ASCII/BINARY/invalid bytes). Shipped as a ruby2html-<version>-java platform gem with the jar prebuilt (no JDK to install); everything else stays pure Ruby. Built by rake-compiler's JavaExtensionTask. TruffleRuby: stop loading the C extension. TruffleRuby runs C through Sulong but JITs pure Ruby with Graal, which renders ~28x faster here; extconf.rb and render.rb now prefer pure Ruby, so Ruby2html.native? is false on TruffleRuby. Ruby 4: .ruby-version -> 4.0.9 (full suite, strict -Werror build and rubocop all green). The CRuby test matrix already tracks the official maintained-versions list (3.3, 3.4, 4.0) with no edit. Release/CI: release.yml builds the -java gem on JRuby and publishes both gems; the CI engines leg builds and smoke-tests the jar; gem-smoke fails loudly if a -java gem lacks the jar; the gemspec is platform-aware and never raises at load. Docs (AGENTS.md, README, llms.txt, CHANGELOG) updated; wurk noted as a sibling under the same developerz.ai model. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Benchmarks: x86_64 (linux)
escape_bench (C ext) · peak RSS 119 MB
escape_bench (pure Ruby) · peak RSS 145 MB
render_bench (C ext) · peak RSS 131 MB
render_bench (pure Ruby) · peak RSS 132 MB
tag_bench (C ext) · peak RSS 40 MB
tag_bench (pure Ruby) · peak RSS 26 MB
Rails request (C ext) · peak RSS 244 MB
|
Benchmarks: aarch64 (linux)
escape_bench (C ext) · peak RSS 118 MB
escape_bench (pure Ruby) · peak RSS 150 MB
render_bench (C ext) · peak RSS 131 MB
render_bench (pure Ruby) · peak RSS 131 MB
tag_bench (C ext) · peak RSS 39 MB
tag_bench (pure Ruby) · peak RSS 26 MB
Rails request (C ext) · peak RSS 235 MB
|
On a clean runner TruffleRuby has no cached .so, and rake-compiler's ExtensionTask still runs its copy task expecting tmp/.../ruby2html.so -- which extconf.rb correctly skips building there -- so `rake compile` failed with ENOENT (it only passed locally thanks to a leftover .so). Treat TruffleRuby like JRuby: define a no-op compile task; pure Ruby is faster there anyway. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging this (a
version.rbbump to 2.1.0) publishes both the C-extension gem and the new-javagem via trusted publishing, then tagsv2.1.0.What's in it
JRuby — Java escaper (~1.9× faster)
A tiny Java extension (
ext/java,Ruby2html::JavaNative) accelerates HTML escaping — the renderer's hot path — over the pure-Ruby twin. Measured on JRuby 10.1: 13k → 25k renders/s, byte-identical output. Everything else stays pure Ruby. Shipped as aruby2html-<v>-javaplatform gem with the jar prebuilt (no JDK needed to install).TruffleRuby — pure Ruby, not Sulong
TruffleRuby runs C extensions through Sulong but JITs pure Ruby with Graal, which here renders ~28× faster (822 → 23k i/s).
extconf.rb/render.rbnow prefer pure Ruby there;Ruby2html.native?isfalseon TruffleRuby.Ruby 4
.ruby-version→ 4.0.9 for the pinned CI jobs (full suite,-Werrorgcc/clang, rubocop — all green). The CRuby matrix already tracks the official list (3.3, 3.4, 4.0) automatically.Release / CI
release.ymlbuilds the-javagem on JRuby and publishes both gems.enginesleg builds + smoke-tests the jar;gem-smokefails loudly if a-javagem lacks the jar.Verification (local, on real engines)
-javagem builds, installs, renders; Java escaper byte-identical across UTF-8/US-ASCII/BINARY/invalid bytes.Invariant check: the Java escaper is a third side of the escape rule only — kept byte-identical with
html_escape.c/PureRuby.escape(arender_specexample asserts it's loaded and matches on JRuby).🤖 Generated with Claude Code